<template>
	test_ts
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue'
import { mapGetters, mapState, useStore } from "vuex";
import { x } from "../utils/main";

export default defineComponent({
	// name: "test_ts",
	data() {
		return {
			num: 1234567
		}
	},

	// mounted() {
	//
	// },

	setup() {
		// interface user {
		// 	name: string,
		// 	age: number,
		// 	say?: (x:string) => string,
		// 	x?:any
		// }
		//
		// let user: user = {
		// 	name: 'Michael',
		// 	age: 39,
		// 	say: (x:string):string => {
		// 		return x
		// 	},
		// 	x:1
		// }
		//
		// console.log(user.name)
		// console.log(user.say?user.say('hello'):'')
		// console.log(user.x)

		interface Good {
			x: number,
			y: number
		}

		interface Hello {
			z: number
		}

		function id(arg: Good, arg2: Hello): any { //
			return Object.assign(arg, arg2);
		}

		id({x: 1, y: 2}, {z: 1})

		/*
				function id<T, Y>(arg: T, arg2: Y): Object { //
			return Object.assign(arg, arg2);
		}

		let value = id<Good, Hello>(
			{
				x: 1,
				y: 2
			}, {
				z: 3
			}
		);

		console.log('value', value)*/

		// 组合是API中使用store
		const store = useStore()

		const storeX = computed(() => store.state.moduleA.x)

		console.log(x)

		return {
			storeX
		}
	}
})
</script>

<style scoped lang="less">

</style>
